<?php

if (isset($_POST['submitEdit'])) {

    
    $date = $_POST['dateAgenda'];
    $place = $_POST['placeAgenda'];
    $desc = $_POST['descAgenda'];
    $sTimeAgenda = $_POST['sTimeAgenda'];
    $eTimeAgenda = $_POST['eTimeAgenda'];
    $id = $_POST['idAgenda'];

    include 'DBLibrary/config.php';
    include 'DBLibrary/openDB.php';

    mysql_select_db("rotaract");

//    get id of the entry in database from the selected radio button
    $query = "SELECT * FROM agenda WHERE id='$id'";
    $result = mysql_query($query) or die(mysql_error());
    $row = mysql_fetch_array($result);
//    selected entry in the database is updated from the result
    $result = mysql_query("UPDATE `rotaract`.`agenda` SET `date`= '$date', `place`= '$place', `desc`= '$desc', `sTimeAgenda`= '$sTimeAgenda', `eTimeAgenda`= '$eTimeAgenda' WHERE `agenda`.`id`= '$id'") or die(mysql_error());


    $confirm = 'Update successful!';
}
